package gui.views;

import gui.settings.LaunchAlsSettings;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;

public class SettingsView extends JPanel implements ActionListener {

    /**
     * Speaking of cluster fuxx. 
     * Should we have 12 different classes for each settings panel or one big-ass class for all of them?
     * a gui.settings-package?
     * 
     */
    private static final long serialVersionUID = 1L;

    public SettingsView() {
        //JPanel jp = new JPanel();
        super(new GridLayout(1, 1));
        //JFrame jf = new JFrame();
        JTabbedPane tabbedPane = new JTabbedPane();
        //ImageIcon icon = createImageIcon("images/middle.gif");

        //JComponent panel1 = makeTextPanel("Panel #1");
        JPanel panel1 = new JPanel();
        tabbedPane.addTab("Ignition Settings", panel1);
        tabbedPane.setMnemonicAt(0, KeyEvent.VK_1);

        JComponent panel2 = new JPanel(); 
        tabbedPane.addTab("PWM outputs", panel2);
        tabbedPane.setMnemonicAt(1, KeyEvent.VK_2);

        JComponent panel3 = new JPanel(); 
        tabbedPane.addTab("AFR control", panel3);
        tabbedPane.setMnemonicAt(2, KeyEvent.VK_3);

        JComponent panel4 = new JPanel(); 
        //panel4.setPreferredSize(new Dimension(410, 50));
        tabbedPane.addTab("Idle settings", panel4);
        tabbedPane.setMnemonicAt(3, KeyEvent.VK_4);
        
        JPanel panel5 = new JPanel();
        tabbedPane.addTab("Temp corrections", panel5);
        tabbedPane.setMnemonicAt(4, KeyEvent.VK_1);
        
        JPanel panel6 = new JPanel();
        tabbedPane.addTab("Start up fuel", panel6);
        tabbedPane.setMnemonicAt(5, KeyEvent.VK_1);
        
        JPanel panel7 = new JPanel();
        tabbedPane.addTab("Launch control", panel7);
        tabbedPane.setMnemonicAt(6, KeyEvent.VK_1);
        
        JPanel panel8 = new JPanel();
        tabbedPane.addTab("Analog settings", panel8);
        tabbedPane.setMnemonicAt(7, KeyEvent.VK_1);
        
        JPanel panel9 = new JPanel();
        tabbedPane.addTab("Limits and Warnings", panel9);
        tabbedPane.setMnemonicAt(8, KeyEvent.VK_1);
        
        JPanel panel10 = new JPanel();
        tabbedPane.addTab("Engine setup", panel10);
        tabbedPane.setMnemonicAt(9, KeyEvent.VK_1);
        
        JPanel panel11 = new JPanel();
        tabbedPane.addTab("Fuel settings", panel11);
        tabbedPane.setMnemonicAt(10, KeyEvent.VK_1);
        
        JPanel panel12 = new JPanel();
        tabbedPane.addTab("Digital outputs", panel12);
        tabbedPane.setMnemonicAt(11, KeyEvent.VK_1);
        
        //LaunchAlsSettings las
        JPanel panel13  = new LaunchAlsSettings();
        tabbedPane.addTab("Launch / ALS", panel13);
        tabbedPane.setMnemonicAt(11, KeyEvent.VK_1);
        
        add(tabbedPane);
        setVisible(true);
        
    }
    
    @Override
    public void actionPerformed(ActionEvent arg0) {
        // TODO Auto-generated method stub
        
    }
    
    /*
    protected JComponent makeTextPanel(String text) {
        JPanel panel = new JPanel(false);
        JLabel filler = new JLabel(text);
        filler.setHorizontalAlignment(JLabel.CENTER);
        panel.setLayout(new GridLayout(1, 1));
        panel.add(filler);
        return panel;
    } */

}
